<%--
  Created by IntelliJ IDEA.
  User: 仁
  Date: 2021-03-09
  Time: 8:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>药店销售管理系统</title>
    <base href="<%=request.getContextPath()%>/"/>
    <link rel="stylesheet" href="webjars/layui/2.5.5/css/layui.css">
</head>
<body>
<div class="layui-container">
    <div class="layui-collapse">
        <div class="layui-colla-item">
            <div class="layui-colla-title">查询条件</div>
            <div class="layui-colla-content layui-show">
                <form class="layui-form layui-inline">

                    <div class="layui-inline">
                        <input type="text" class="layui-input" id="drugname" placeholder="根据药品名称进行查询">
                    </div>
                    <div class="layui-input-inline">
                        <button type="button" class="layui-btn" id="chaxun" onclick="search()" data-type="reload">查询</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script type="text/html" id="toolbar">
        <button type="button" class="layui-btn" id="tjin">增加用户</button>
    </script>
    <table id="roleTb" lay-filter="roleTb"></table>
</div>
<script src="webjars/layui/2.5.5/layui.js"></script>
<script>
    layui.use(['form','table','jquery'], function(){
            let table=layui.table;
            table.render({
                id:"roleTb",
                elem:"#roleTb",
                url:"jinhuoxinxi/pagexinxi",
                cols: [[
                    {title:"药品姓名",field: "drugname"},
                    {title:"厂商",field: "changshang"},
                    {title:"备注",field:"beizhu"},
                    {title:"数量",field:"amount"},
                    {title:"有效期",field:"date"},
                    {title:"批号",field:"pihao"},
                    {title:"进货时间",field:"begindate"},
                    {title:"供货商",field:"gonghuoshang"},
                ]],
                page:{limit:4,limits:[8,12]}
            })
        })

    function search() {
        layui.use(["jquery","table"],function () {
            let $=layui.jquery;
            let drugname=$("#drugname").val();
            let where = {drugname:drugname};
            layui.table.reload("roleTb",{where});
        })


    }
</script>
</body>
</html>
